package com.wx.forum.controller;

import com.wx.forum.exception.ApplicationException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "测试")
@RestController
@RequestMapping("/test")
public class test {
    @RequestMapping("/t")
    @ApiOperation("测试接口1")
    //@RequestParam("name")，这个name是url获得参数的name，（key）
    public String test(@ApiParam(value = "姓名") @RequestParam("name") String name){

        return "name" + name;
    }
    @GetMapping("/exception")
    public String testException() throws Exception {
        throw new Exception("");
    }
    @GetMapping("/appException")
    public String testApplicationException() {
        throw new ApplicationException("这是⼀个⾃定义的ApplicationException");
    }

}
